.searchContainer {
    position: relative;
    width: 300px;
    max-width: 100%;
}

/* Search Button (replaces input in navbar) */
.searchButton {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--ifm-toc-border-color);
  border-radius: 4px;
  font-size: 16px;
  background: var(--ifm-background-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: border 0.2s;
  text-align: left;
}

.searchButton:hover {
  border-color: var(--ifm-color-primary-darkest);
}

.searchIcon {
  font-size: 16px;
  opacity: 0.7;
}

.searchPlaceholder {
  color: var(--ifm-font-color-secondary);
  flex: 1;
}

/* Modal Overlay */
.modalOverlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
}

/* Modal Content */
.modalContent {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 680px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

/* Modal Header */
.modalHeader {
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--ifm-toc-border-color);
}
  
.searchInputWrapper {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}

.searchIconInput {
  position: absolute;
  left: 16px;
  font-size: 18px;
  opacity: 0.5;
}

.searchInput {
  width: 100%;
  padding: 14px 40px 14px 46px;
  border: 2px solid var(--ifm-toc-border-color);
  border-radius: 8px;
  font-size: 16px;
  outline: none;
  transition: border 0.2s;
}

.searchInput:focus {
  border-color: var(--ifm-color-primary-darkest);
  box-shadow: 0 0 0 3px var(--docusaurus-admonition-tip-bg);
}

.clearButton {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--ifm-font-color-secondary);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.clearButton:hover {
  background-color: var(--ifm-color-emphasis-100);
}

.searchingIndicator {
  position: absolute;
  right: 46px;
  color: var(--ifm-font-color-secondary);
  font-size: 14px;
}

/* Filter Tabs */
.filterTabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filterTab {
  padding: 8px 16px;
  border: 1px solid var(--ifm-toc-border-color);
  border-radius: 20px;
  background: var(--ifm-background-color);
  color: var(--ifm-font-color-secondary);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  white-space: nowrap;
}

.filterTab:hover {
  border-color: var(--ifm-color-primary-darkest);
  background-color: var(--ifm-color-primary-lightest);
}

.filterTabActive {
  background-color: var(--ifm-color-primary-darkest);
  border-color: var(--ifm-color-primary-darkest);
  color: var(--ifm-color-white);
}

.filterTabActive:hover {
  background-color: var(--ifm-color-primary-dark);
  border-color: var(--ifm-color-primary-dark);
}

/* Modal Body */
.modalBody {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
}

/* Empty State */
.emptyState {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  color: var(--ifm-font-color-secondary);
}

.emptyStateIcon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.emptyStateText {
  font-size: 18px;
  margin: 0;
}

/* Loading State */
.loadingState {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  color: var(--ifm-font-color-secondary);
}

.loadingState p {
  margin-top: 16px;
  margin-bottom: 0;
}

/* No Results State */
.noResultsState {
  padding: 80px 24px;
  text-align: center;
}

/* Search Results */
.searchResults {
  padding: 0;
}

.searchResults ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.searchResults li {
  padding: 16px 24px;
  cursor: pointer;
  border-bottom: 1px solid var(--ifm-color-emphasis-100);
  transition: background-color 0.2s;
}

.searchResults li:last-child {
  border-bottom: none;
}

.searchResults li:hover {
  background-color: var(--ifm-color-primary-lightest);
}

.resultTitle a {
  color: var(--ifm-font-color-base);
  text-decoration: none;
}

.resultTitle a:hover {
  text-decoration: underline;
}


.resultTitle {
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--ifm-font-color-base);
}

.resultSnippet {
  font-size: 12px;
  color: var(--ifm-font-color-secondary);
}

.resultSnippet strong {
  color: var(--ifm-color-primary-darkest);
  font-weight: 600;
  background-color: var(--docusaurus-admonition-tip-bg);
  padding: 0 2px;
}
.resultSnippet mark {
  background: var(--ifm-color-primary-lightest);
  padding: 0 2px;
  border-radius: 2px;
}


.noResults {
  margin: 0;
  font-size: 16px;
  color: var(--ifm-font-color-secondary);
}

.resultMeta {
  display: flex;
  gap: 8px;
  margin: 2px 0 6px;
  font-size: 12px;
  color: var(--ifm-font-color-secondary);
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--ifm-toc-border-color);
  border-top-color: var(--ifm-color-primary-darkest);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Dark Mode Support */
[data-theme="dark"] .searchButton {
  background: transparent;
  color: var(--ifm-color-primary-darkest);
}

[data-theme="dark"] .searchButton:hover {
  border-color: var(--ifm-color-primary-darkest);
}

[data-theme="dark"] .searchPlaceholder {
  color: var(--ifm-font-color-secondary);
}

[data-theme="dark"] .modalContent {
  background: var(--ifm-background-color);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .modalHeader {
  border-bottom-color: var(--ifm-toc-border-color);
}

[data-theme="dark"] .searchInput {
  background: var(--ifm-background-surface-color);
  border-color: var(--ifm-toc-border-color);
  color: var(--ifm-font-color-base);
}

[data-theme="dark"] .searchInput:focus {
  border-color: var(--ifm-color-primary-darkest);
}

[data-theme="dark"] .filterTab {
  background: var(--ifm-background-surface-color);
  border-color: var(--ifm-toc-border-color);
  color: var(--ifm-font-color-secondary);
}

[data-theme="dark"] .filterTab:hover {
  background-color: var(--ifm-color-emphasis-200);
  border-color: var(--ifm-color-primary-darkest);
}

[data-theme="dark"] .filterTabActive {
  background-color: var(--ifm-color-primary-darkest);
  color: var(--ifm-toc-border-color);
  border-color: var(--ifm-color-primary-darkest);
}

[data-theme="dark"] .filterTabActive:hover {
  background-color: var(--ifm-color-primary-light);
  border-color: var(--ifm-color-primary-light);
}

[data-theme="dark"] .searchResults li {
  border-bottom-color: var(--ifm-color-emphasis-200);
}

[data-theme="dark"] .searchResults li:hover {
  background-color: var(--ifm-background-surface-color);
}

[data-theme="dark"] .resultTitle a {
  color: var(--ifm-font-color-base);
}

[data-theme="dark"] .resultSnippet {
  color: var(--ifm-font-color-secondary);
}

[data-theme="dark"] .clearButton:hover {
  background-color: var(--ifm-color-emphasis-200);
}

[data-theme="dark"] .emptyState,
[data-theme="dark"] .loadingState,
[data-theme="dark"] .noResultsState {
  color: var(--ifm-font-color-secondary);
}

[data-theme="dark"] .noResults {
  color: var(--ifm-font-color-secondary);
}

/* Responsive */
@media (max-width: 768px) {
  .searchContainer {
    width: 100%;
  }

  .modalOverlay {
    padding-top: 5vh;
  }

  .modalContent {
    width: 95%;
    max-height: 85vh;
  }

  .modalHeader {
    padding: 16px;
  }

  .filterTabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .filterTabs::-webkit-scrollbar {
    display: none;
  }

  .filterTab {
    font-size: 13px;
    padding: 6px 12px;
  }

  .searchResults li {
    padding: 12px 16px;
  }

  .emptyState,
  .loadingState,
  .noResultsState {
    padding: 60px 16px;
  }
}